package websocket

import (
	"net/http"
)

type DialOption func(option *dialOption)

type dialOption struct {
	pattern string
	header  http.Header
	Discover
}

func newDialOption(opts ...DialOption) *dialOption {
	doption := &dialOption{
		pattern:  "/ws",
		header:   nil,
		Discover: &nopDiscover{},
	}
	for _, opt := range opts {
		opt(doption)
	}
	return doption
}

func WithClientPattern(pattern string) DialOption {
	return func(option *dialOption) {
		option.pattern = pattern
	}
}

func WithClientDiscover(dis Discover) DialOption {
	return func(option *dialOption) {
		option.Discover = dis
	}
}

func WithClientHeader(header http.Header) DialOption {
	return func(option *dialOption) {
		option.header = header
	}
}
